import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
let userInfo = localStorage.getItem("userInfo")
    userInfo = JSON.parse(userInfo)
export default new Vuex.Store({
  state: {
    userInfo: userInfo
  },
  mutations: {
    setUserInfo(state, payload) {
      state.userInfo = payload
      localStorage.setItem("userInfo", JSON.stringify(payload))
    }
  },
  getters: {
    userInfo(state) {
      return state.userInfo
    }
  },
  actions: {}
});
